<!DOCTYPE html>
<html>

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta name="viewport"
    content="width=device-width,initial-scale=1,user-scalable=0,minimum-scale=1.0,maximum-scale=1.0" />
  <meta name="author" content="火星科技 http://mars3d.cn " />
  <meta name="apple-touch-fullscreen" content="yes" />
  <meta name="apple-mobile-web-app-capable" content="yes" />
  <meta name="apple-mobile-web-app-status-bar-style" content="black" />
  <meta name="format-detection" content="telephone=no" />
  <meta name="x5-fullscreen" content="true" />
  <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
  <!-- 标题及搜索关键字 -->
  <meta name="keywords" content="火星科技,cesium,3D,GIS,marsgis,三维,地球,地图,开发,框架,系统,示例,资料,模型,离线,外包,合肥,安徽,中国" />
  <meta
    name="description"
    content="火星科技 合肥火星 合肥火星科技 合肥火星科技有限公司 leaflet leaflet框架 leaflet开发 cesium cesium开发 cesium框架 三维 地球 模型  gis marsgis 地图离线 地图开发 地图框架 地图外包 框架 开发 外包  地图离线 二维地图 三维地图 全景漫游 地理信息系统 云GIS 三维GIS GIS平台 WebGIS" />

  <link rel="shortcut icon" type="image/x-icon" href="/img/favicon/favicon.ico" />
  <title>时序任务 | Mars3D | 三维地图 | 火星科技 | 合肥火星科技有限公司</title>

  <!--第三方lib-->
  <script
    type="text/javascript"
    src="/lib/include-lib.js"
    libpath="/lib/"
    include="jquery,layer,toastr,font-awesome,bootstrap,bootstrap-checkbox,bootstrap-slider,bootstrap-table,layer,haoutil,mars3d"></script>

  <link href="/css/style.css" rel="stylesheet" />

  <style>
    .active-row {
      background-color: red;
    }

    .bootstrap-table .fixed-table-container .fixed-table-body {
      max-height: none;
    }
  </style>
</head>

<body class="dark">
  <div id="mars3dContainer" class="mars3d-container"></div>

  <!-- 面板 -->
  <div class="infoview" style="top: 10px">
    <input type="button" class="btn btn-primary" value="重新开始" onclick="clickStart()" />
    <input type="button" class="btn btn-primary" value="暂停" id="pauseBtn" onclick="clickPause()" />
    <input type="button" class="btn btn-primary" value="继续" id="continueBtn" onclick="clickContinue()" />

    <table id="listTable"></table>

    <div class="f-mt">
      <span id="listInfo"></span>
      当前正在执行第<span id="activeIndex"></span>个
    </div>
  </div>

  <script src="/js/common.js"></script>

  <!--加载注册的单个任务-->
  <script src="/lib/mars3d/extends/CameraList.js"></script>
  <script src="/lib/mars3d/extends/CameraView.js"></script>
  <script src="/lib/mars3d/extends/MapRotate.js"></script>
  <script src="/lib/mars3d/extends/PointRotate.js"></script>
  <script src="/lib/mars3d/extends/RouteLine.js"></script>
  <script src="/lib/mars3d/extends/ZoomIn.js"></script>
  <script src="/lib/mars3d/extends/ZoomOut.js"></script>
  <script src="/lib/mars3d/extends/GraphicStyle.js"></script>
  <script src="/lib/mars3d/extends/CreateTarget.js"></script>
  <script src="/lib/mars3d/extends/SceneOptions.js"></script>

  <script src="./map.js"></script>

  <script type="text/javascript">
    "use script" //开发环境建议开启严格模式

    eventTarget.on("getTableData", (event) => {
      const list = event.list
      $("#listInfo").html(`总时长${event.allDuration}秒，共${list.length}任务`)

      const tableData = list.map((item, index) => {
        return { key: index + 1, name: item.name, startstop: item.start + "-" + item.stop, duration: item.duration }
      })
      $("#listTable").bootstrapTable({
        data: tableData,
        pagination: false,
        singleSelect: false,
        checkboxHeader: false,
        rowStyle: function (row, index) {
          if (row.key == 1) {
            return { css: { "background-color": "#1487f5" } }
          }
          return ""
        },
        columns: [
          {
            title: "序号",
            align: "center",
            field: "key"
          },
          {
            title: "名称",
            field: "name",
            align: "center"
          },
          {
            title: "时间范围",
            field: "startstop",
            align: "center"
          },
          {
            title: "时长",
            field: "duration",
            align: "center"
          }
        ]
      })
    })
    eventTarget.on("changeIndex", (event) => {
      const activeIndex = event.index + 1

      $("#activeIndex").html(activeIndex)

      $("#listTable").bootstrapTable("refreshOptions", {
        rowStyle: function (row, index) {
          if (row.key == activeIndex) {
            return { css: { "background-color": "#1487f5" } }
          }
          return ""
        }
      })
    })

    function initUI(options) {
      $("#pauseBtn").show()
      $("#continueBtn").hide()
    }

    function clickStart() {
      startPlay()
      $("#pauseBtn").show()
      $("#continueBtn").hide()
    }
    function clickPause() {
      updateShouldAnimate(false)
      $("#pauseBtn").hide()
      $("#continueBtn").show()
    }
    function clickContinue() {
      updateShouldAnimate(true)
      $("#pauseBtn").show()
      $("#continueBtn").hide()
    }
  </script>
</body>

</html>
